using System;
using System.Collections.Generic;

using EntModApp.EntServices.Data;

namespace DemoApp.DataAccess 
{
  public static class PersonPropertyNames
  {
    public const string FirstName = @"FirstName"; 

    public const string LastName = @"LastName"; 

    public const string Email = @"Email"; 

    public const string UserId = @"UserId"; 

    public const string UserName = @"UserName"; 

    public const string Password = @"Password"; 

  }

  public static class PersonReferenceNames
  {
    public const string Roles = @"Roles"; 

    public const string Groups = @"Groups"; 

    public const string CreatedSubjects = @"CreatedSubjects"; 

    public const string EditedSubjects = @"EditedSubjects"; 

  }

  [Serializable]
  public partial class PersonLoadSettings : UserLoadSettings
  {

    public PersonLoadSettings()
    {
      OnCreate();
    }

    public new PersonFilterExpression Filter 
    { 
      get 
      { 
        base.Filter = PersonFilterExpression.FromUserFilterExpression(base.Filter);
        return base.Filter as PersonFilterExpression;
      }
      set { base.Filter = value; }
    }

    public PersonSelectionSettings Selection 
    { 
      get 
      { 
        base.Selection = PersonSelectionSettings.FromUserSelectionSettings(base.Selection);
        return base.Selection as PersonSelectionSettings;
      }
      set { base.Selection = value; }
    }

    public PersonInclusionSettings Inclusion 
    { 
      get 
      { 
        base.Inclusion = PersonInclusionSettings.FromUserInclusionSettings(base.Inclusion);
        return base.Inclusion as PersonInclusionSettings;
      }
      set { base.Inclusion = value; }
    }

    public PersonSortingSettings Sorting 
    { 
      get 
      { 
        base.Sorting = PersonSortingSettings.FromUserSortingSettings(base.Sorting);
        return base.Sorting as PersonSortingSettings;
      }
      set { base.Sorting = value; }
    }

    partial void OnCreate();

    public static new PersonLoadSettings FromUserLoadSettings(UserLoadSettings other)
    {
      if (other is PersonLoadSettings) return other as PersonLoadSettings;
      var result = new PersonLoadSettings();
      result.CopyFrom(other);
      return result;
    }

    public static PersonLoadSettings FromPersonLoadSettings(PersonLoadSettings other)
    {
      if (other != null) return other;
      var result = new PersonLoadSettings();
      return result;
    }

  }

  [Serializable]
  public partial class PersonFilterExpression : UserFilterExpression 
  {
    public SimpleFilterExpression<string> FirstNameFilter { get; set; }

    public SimpleFilterExpression<string> LastNameFilter { get; set; }

    public SimpleFilterExpression<string> EmailFilter { get; set; }

    partial void OnCreate();

    protected override void CopyFrom(UserFilterExpression other)
    {
      base.CopyFrom(other);
      if (other is PersonFilterExpression)
      {
        var item = (PersonFilterExpression)other;
      }
    }

    public static new PersonFilterExpression FromUserFilterExpression(UserFilterExpression other)
    {
      if (other is PersonFilterExpression) return other as PersonFilterExpression;
      var result = new PersonFilterExpression();
      result.CopyFrom(other);
      return result;
    }

    public static PersonFilterExpression FromPersonFilterExpression(PersonFilterExpression other)
    {
      if (other != null) return other;
      var result = new PersonFilterExpression();
      return result;
    }

  }

  [Serializable]
  public partial class PersonSelectionSettings : UserSelectionSettings 
  {
    public PersonSelectionSettings()
    {
      SelectFirstName = true;
      SelectLastName = true;
      SelectEmail = true;

      OnCreate();
    }

    public bool SelectFirstName { get; set; } 

    public bool SelectLastName { get; set; } 

    public bool SelectEmail { get; set; } 

    partial void OnCreate();

    protected override void CopyFrom(UserSelectionSettings other)
    {
      base.CopyFrom(other);
      if (other is PersonSelectionSettings)
      {
        var item = (PersonSelectionSettings)other;
        SelectFirstName = item.SelectFirstName;
        SelectLastName = item.SelectLastName;
        SelectEmail = item.SelectEmail;
      }
    }

    public static new PersonSelectionSettings FromUserSelectionSettings(UserSelectionSettings other)
    {
      if (other is PersonSelectionSettings) return other as PersonSelectionSettings;
      var result = new PersonSelectionSettings();
      result.CopyFrom(other);
      return result;
    }

    public static PersonSelectionSettings FromPersonSelectionSettings(PersonSelectionSettings other)
    {
      if (other != null) return other;
      var result = new PersonSelectionSettings();
      return result;
    }

  }

  [Serializable]
  public partial class PersonInclusionSettings : UserInclusionSettings 
  {
    public PersonInclusionSettings()
    {
      OnCreate();
    }


    partial void OnCreate();

    protected override void CopyFrom(UserInclusionSettings other)
    {
      base.CopyFrom(other);
      if (other is PersonInclusionSettings)
      {
        var item = (PersonInclusionSettings)other;
      }
    }

    public static new PersonInclusionSettings FromUserInclusionSettings(UserInclusionSettings other)
    {
      if (other is PersonInclusionSettings) return other as PersonInclusionSettings;
      var result = new PersonInclusionSettings();
      result.CopyFrom(other);
      return result;
    }

    public static PersonInclusionSettings FromPersonInclusionSettings(PersonInclusionSettings other)
    {
      if (other != null) return other;
      var result = new PersonInclusionSettings();
      return result;
    }

  }

  [Serializable]
  public partial class PersonSortingSettings : UserSortingSettings 
  {
    public PersonSortingSettings()
    {
      OnCreate();
    }


    partial void OnCreate();

    protected override void CopyFrom(UserSortingSettings other)
    {
      base.CopyFrom(other);
      if (other is PersonSortingSettings)
      {
        var item = (PersonSortingSettings)other;
      }
    }

    public static new PersonSortingSettings FromUserSortingSettings(UserSortingSettings other)
    {
      if (other is PersonSortingSettings) return other as PersonSortingSettings;
      var result = new PersonSortingSettings();
      result.CopyFrom(other);
      return result;
    }

    public static PersonSortingSettings FromPersonSortingSettings(PersonSortingSettings other)
    {
      if (other != null) return other;
      var result = new PersonSortingSettings();
      return result;
    }

  }
}
